/// @tags: Pólya Burnside
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

constexpr int base = 1e4;

struct BigNumber {
  int l;
  int a[55];

  inline BigNumber(int x = 0) {
    memset(a, 0, sizeof(a));
    l = bool(x);
    a[1] = x;
  }

  inline int &operator[](int index) { return a[index]; }
  inline const int &operator[](int index) const { return a[index]; }

  inline void carry() {
    while (a[l + 1] > 0) {
      ++l;
      a[l + 1] = a[l] / base;
      a[l] %= base;
    }
  }

  inline void print() {
    cout << a[l];
    for (int i = l - 1; i >= 1; --i) cout << std::setw(4) << std::setfill('0') << a[i];
  }

  BigNumber operator+(const BigNumber &) const;
  BigNumber operator*(const BigNumber &) const;
  BigNumber operator/(int) const;
};

inline BigNumber BigNumber::operator+(const BigNumber &rhs) const {
  BigNumber c;
  c.l = std::max(l, rhs.l);
  for (int i = 1; i <= c.l; ++i) {
    c[i] += a[i] + rhs[i];
    c[i + 1] += c[i] / base;
    c[i] %= base;
  }
  c.carry();
  return c;
}

BigNumber BigNumber ::operator*(const BigNumber &rhs) const {
  BigNumber c;
  c.l = l + rhs.l - 1;
  for (int i = 1; i <= l; ++i)
    for (int j = 1; j <= rhs.l; ++j) c[i + j - 1] += a[i] * rhs[j];
  for (int i = 1; i <= c.l; ++i) {
    c[i + 1] += c[i] / base;
    c[i] %= base;
  }
  c.carry();
  return c;
}

inline BigNumber BigNumber::operator/(int b) const {
  BigNumber c(*this);
  for (int i = c.l; i >= 1; --i) {
    c[i - 1] += (c[i] % b) * base;
    c[i] /= b;
  }
  while (c.l > 1 && c[c.l] == 0) --c.l;
  return c;
}

inline BigNumber qpow(int exp) {
  BigNumber res(1), x(2);
  for (; exp; exp >>= 1, x = x * x)
    if (exp & 1) res = res * x;
  return res;
}

inline int main() {
  int n;
  cin >> n;
  int identity = n * (n + 1) / 2;
  int rotate = (identity + 2) / 3;
  int reverse = (identity - (n + 1) / 2) / 2 + (n + 1) / 2;
  ((qpow(identity) + qpow(rotate) + qpow(rotate) + qpow(reverse) + qpow(reverse) + qpow(reverse)) /
   6)
      .print();
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.print", "w", stdout);
#else
  freopen("P2561 [AHOI2002] 黑白瓷砖.in", "r", stdin);
  freopen("P2561 [AHOI2002] 黑白瓷砖.print", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
